﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;
using NLite.Domain.Mapping;

namespace NLite.Domain.Wcf
{

    [ServiceContract]
    public interface IRemoteDispatcherService
    {
        [OperationContract]
        ResponseWrapper Dispatch(RequestWrapper req);
    }

    [DataContract]
    public class RequestWrapper
    {
        /// <summary>
        /// 得到服务名
        /// </summary>
        [DataMember]
        public string ServiceName { get; set; }
        /// <summary>
        /// 得到服务方法名
        /// </summary>
        [DataMember]
        public string OperationName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public bool HasBindingModel { get; set; }

        /// <summary>
        /// Gets or sets a value that indicates whether request validation is enabled for this request.
        /// </summary>
        [DataMember]
        public bool ValidateRequest { get; set; }

        [DataMember]
        public byte[] Body { get; set; }
    }



    [Serializable]
    public class RequestBody
    {
        public IDictionary<string, object> Data { get; set; }
        public IDictionary<string, object> Context { get; set; }
    }
    [DataContract]
    public class ResponseWrapper
    {
        [DataMember]
        public bool Success { get; set; }
        [DataMember]
        public byte[] Body { get; set; }
    }


    [Serializable]
    public class ResponseBody
    {
       // public INavigationResult ActionResult { get; set; }
        public object Data { get; set; }
        public NLite.ErrorState ErrorState { get; set; }
        public Exception[] Exceptions { get; set; }

        public IDictionary<string, object> Context { get; set; }
    }

}
